package cn.lijida.weiwei.favor.modules.account.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.lijida.weiwei.favor.modules.account.entity.FavorAccountHome;
import cn.lijida.weiwei.favor.modules.account.mapper.FavorAccountHomeMapper;
import cn.lijida.weiwei.favor.modules.account.service.IFavorAccountHomeService;

/**
 * <p>
 * 家庭 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-12-28
 */
@Service
public class FavorAccountHomeServiceImpl extends ServiceImpl<FavorAccountHomeMapper, FavorAccountHome> implements IFavorAccountHomeService {

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void join(Long accountId, Long createHome) throws Exception {
		FavorAccountHome entity = new FavorAccountHome();
		entity.setAccountId(accountId);
		entity.setHomeId(createHome);
		boolean status = this.save(entity);
		if(!status){
			throw new Exception("账簿家庭关联失败");
		}
	}

}
